import { editor } from "@codingame/monaco-editor";
import { FileManager } from "../FileManager";
import { AllThemes } from "../Theme/AllThemes";
import { applyTheme } from "../Theme/initTheme";

export const Theme = () => {
    return {
        name: "theme",
        setup(this: FileManager, ed: editor.IStandaloneCodeEditor) {
            const status = this.statusBar.addStatus("theme");
            status.textContent = "github-dark";
            status.title = "Theme";
            AllThemes.forEach((i) => {
                ed.addAction({
                    id: "theme_" + i.name,
                    label: "Theme: " + i.name,
                    run() {
                        status.textContent = i.name;
                        applyTheme(i.name);
                    }, // 点击后执行的操作
                });
            });
        },
    };
};
